Option Returns





Kerry Back

Option Data from Yahoo

import yfinance as yf
tick = yf.Ticker('aapl')
  • tick.options is the set of traded maturities
  • tick.option_chain(“some date”) is an object containing call and put data
  • tick.option_chain(“some date”).calls is a dataframe of call info
  • tick.option_chain(“some date”).puts is a dataframe of put info

Apple stock price on Feb 3, 2023

tick.history().iloc[-1].round(2)
Open                 148.03
High                 157.38
Low                  147.83
Close                155.80
Volume          73664316.00
Dividends              0.00
Stock Splits           0.00
Name: 2023-02-03 00:00:00, dtype: float64

Apple calls on Feb 3, 2023

df = tick.option_chain("2023-03-17").calls
df = df.set_index("strike")
df.iloc[:,2:5].loc[130:170]

lastPrice bid ask
strike
130.0 26.88 26.70 27.05
135.0 22.22 21.90 22.20
140.0 17.61 17.60 17.80
145.0 13.45 13.30 13.55
150.0 9.71 9.50 9.65
155.0 6.49 6.40 6.55
160.0 4.10 4.05 4.15
165.0 2.39 2.38 2.41
170.0 1.30 1.31 1.35

Possible call returns

Suppose we bought the 140 (in the money) or the 150 or the 160 (out of the money) calls at the last prices shown.

Apple puts on Feb 2, 2023

df = tick.option_chain("2023-03-17").puts
df = df.set_index("strike")
df.iloc[:,2:5].loc[130:170]

lastPrice bid ask
strike
130.0 0.52 0.50 0.52
135.0 0.77 0.77 0.78
140.0 1.24 1.22 1.23
145.0 2.02 2.00 2.04
150.0 3.25 3.20 3.25
155.0 5.10 5.05 5.10
160.0 7.75 7.70 7.85
165.0 10.55 10.90 11.20
170.0 14.50 14.80 15.15

Possible put returns

Suppose we bought the 140 (out of the money) or the 150 or the 160 (in the money) puts at the last prices shown.